/**
 * 管理初始化
 */

Grid.PrimaryKey = "vId";
Grid.title = "年假";
Grid.controllerName = "/attendance/vacation";

/**
 * 初始化表格的列
 */
Grid.initColumn = function () {
    var columns = [
        {field: 'selectItem', radio: true},
        {title: 'id', field: 'vId', visible: false, align: 'center', valign: 'middle'},
        {title: '年度', field: 'vYear', align: 'center', valign: 'middle', sortable: true},
        {title: '员工', field: 'vUserName', align: 'center', valign: 'middle', sortable: true},
        {title: '年休假天数', field: 'vDayNum', align: 'center', valign: 'middle', sortable: true},
        {title: '剩余天数', field: 'vDayNumRemain', align: 'center', valign: 'middle', sortable: true}
    ];
    return columns;
};

/**
 * 重置搜索
 */
Grid.resetSearch = function () {
    $("#vUser").val("");
    $("#vYear").val("");
    Grid.search();
}

/**
 * 查询列表
 */
Grid.search = function () {
    var queryData = {};
    queryData['vUser'] = $("#vUser").val();
    queryData['vYear'] = $("#vYear").val();
    Grid.table.refresh({query: queryData});
};


$(function () {
    var defaultColunms = Grid.initColumn();
    var table = new BSTable(Grid.id, "/attendance/vacation/list", defaultColunms);
    table.setPaginationType("server");
    Grid.table = table.init();

});
